<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div onclick="showMsg(this,event)" id="outSide" style="width:100px; height:100px; background:#000; padding:50px">
    <div onclick="showMsg(this,event)" id="inSide" style="width:100px; height:100px; background:#CCC"></div>
</div>
<script type="text/javascript">

function showMsg(obj,e) {
    alert(obj.id,e);
    stopBubble(e);
}
function stopBubble(e){
    if(e&&e.stopPropagation){
        alert("aa")
        e.stopPropagation()
    }else{
        e.cancelBubble=true
    }
}
</script>
</body>
</html>